package com.summer.shopping.chat;

import lombok.Data;
import lombok.ToString;
import org.springframework.web.socket.WebSocketSession;

@Data
public class WSInfo {
    private String type;//这里是消息类型，比如："info"
    private String content;//这里是消息内容
    private Long to;//这里是接受者的userId


    public Standard toStandard(WebSocketSession session, UserChatPool userChatPool){
        Standard standard = new Standard();
        standard.setType(type);
        standard.setContent(content);
        standard.setTo(to);
        Long toUserId = userChatPool.getUserId(session);
        standard.setFrom(toUserId);
        return standard;
    }

    @Data
    @ToString
    public static class Standard{
        private String type;//这里是消息类型，比如："info"
        private String content;//这里是消息内容
        private Long to;//这里是接受者的userId

        private Long from;


    }
}
